
import { STOCKS_TIPS_NUM, STOCKS_TIPS_RESET } from '../actions/constants'

import _ from 'lodash'

const initialState = {
  stockTipsThreshold: 10,
}

export default (state = initialState, { type, payload }) => {
  const copy = _.cloneDeep(initialState)
  switch (type) {

  case STOCKS_TIPS_NUM:
    copy.stockTipsThreshold = payload.num
    return copy

  case   STOCKS_TIPS_RESET:
    copy.stockTipsThreshold = 10
    return copy

  default:
    return state
  }
}
